package com.imau.servlet;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/getPar")
public class GetParServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

        this.doPost(request, response);
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

        //Tomcat9
        request.setCharacterEncoding("UTF-8");
        //1.获取参数

        String username = request.getParameter("username");
//        //2.解码
//        byte[] bytes = username.getBytes(StandardCharsets.ISO_8859_1);

        System.out.println(username);

    }
}
